home *** CD-ROM | disk | FTP | other *** search
/ Medabots Cardz / Medabots CD Cardz Sumilidon.bin / mac / assets / sumilidon.dxr / 00006_Script_6 < prev    next >
Text File  |  2001-12-07  |  3KB  |  118 lines

  1. property pSpeed, dx, dy, mysprite, counter, buttonover
  2. global showarea, discx, discy, area, smallmedal, portdy, portdx, goback, portnum, medaldown, transitionz, amiwideopen, playonce, onedown
  3.  
  4. on beginsprite me
  5.   set mysprite to the spritenum of me
  6.   set the blend of sprite mysprite = 100
  7.   set dx to the loch of sprite(mysprite)
  8.   set dy to the locv of sprite(mysprite)
  9.   counter = 1
  10. end
  11.  
  12. on mouseEnter me
  13.   if smallmedal = 0 then
  14.     showarea = 1
  15.     buttonover = 1
  16.     puppetsound ("hum2"),2
  17.   end if
  18. end
  19.  
  20. on mouseLeave me
  21.   if smallmedal = 0 then
  22.     showarea = 0
  23.     buttonover = 0
  24.     set the member of sprite mysprite = ("medal")
  25.     puppetsound 1,0
  26.   end if
  27. end
  28.  
  29.  
  30. on mouseDown me
  31.   medaldown = 1
  32. end
  33.  
  34. on mouseUp me
  35.   medaldown = 0
  36.   if smallmedal = 0 then
  37.     if sprite mysprite intersects sprite(portnum) then
  38.       onedown = 1
  39.       set the blend of sprite mysprite = 0
  40.       set the loch of sprite mysprite to dx
  41.       set the locv of sprite mysprite to dy
  42.       smallmedal = 1
  43.       area = 1
  44.       transitionz = "close"
  45.     else
  46.       set the loch of sprite mysprite to dx
  47.       set the locv of sprite mysprite to dy
  48.     end if 
  49.   end if
  50. end
  51.  
  52. on exitframe
  53.   if medaldown = 1 then
  54.     buttonover = 0
  55.   end if
  56.   
  57.   if area = 0 then
  58.     if amiwideopen = "yes" then
  59.       sprite(mysprite).moveablesprite = TRUE
  60.       end if
  61.     else
  62.       sprite(mysprite).moveablesprite = FALSE
  63.     end if
  64.     
  65.     if goback = 1 then
  66.       set the blend of sprite mysprite = 100
  67.       goback = 0
  68.     end if
  69.     
  70.     if buttonover = 1 then
  71.       if counter < 6 then
  72.         counter = counter + 1
  73.       end if
  74.       if counter = 2 then 
  75.         set the member of sprite mysprite = ("roll1")
  76.       else  if counter = 3 then 
  77.         set the member of sprite mysprite = ("roll2")
  78.       else  if counter = 4 then 
  79.         set the member of sprite mysprite = ("roll3")
  80.       else  if counter = 5 then 
  81.         set the member of sprite mysprite = ("roll4")
  82.       else  if counter = 6 then 
  83.         set the member of sprite mysprite = ("roll5")
  84.         counter = 1
  85.       end if
  86.     end if
  87.     
  88.     
  89.     
  90.     if sprite mysprite intersects sprite(portnum) then
  91.       --    set the width of sprite(mysprite) to 38
  92.       --    set the height of sprite(mysprite) to 40
  93.     else 
  94.       --    set the width of sprite(mysprite) to 66
  95.       --    set the height of sprite(mysprite) to 77
  96.     end if
  97. end
  98.  
  99.  
  100. -- move character
  101. on move me, dx, dy
  102.   -- get current loc
  103.   loc = sprite(me.spriteNum).loc
  104.   
  105.   -- move loc and rect
  106.   global pSpeed
  107.   loc = loc + point(dx,dy)*pSpeed
  108.   rect = rect + rect(dx*pSpeed,dy*pSpeed,dx*pSpeed,dy*pSpeed)
  109.   
  110.   -- safety check to make sure character stays on screen
  111.   if rect.left < 0 then exit
  112.   if rect.top < 0 then exit
  113.   if rect.right > (the stage).rect.width then exit
  114.   if rect.bottom > (the stage).rect.height then exit
  115.   
  116.   -- set new character location
  117.   sprite(me.spriteNum).loc = loc
  118. end